package com.yitao.cms.controller.product;

import com.skipper.base.bean.DataOutput;
import com.yitao.client.dto.product.ProductSpecificationDto;
import com.yitao.cms.config.aopLog.LogAnnotation;
import com.yitao.cms.dto.product.ProductSpecificationAddDto;
import com.yitao.cms.service.product.ProductSpecificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
  * @Author:Wwl
  * @Description:
  * @Date:18:20 2019/3/9
  */


@Api(value = "/cms/productSpecification", description = "商品规格表相关接口", tags = {"cms-product-specification"})
@RestController
@RequestMapping(value = "/productSpecification" , produces = {"application/json"})
public class ProductCmsSpecificationController {
    @Autowired
    private ProductSpecificationService productSpecificationService;


    @ApiOperation("批量添加其他信息(添加产品第三步)")
    @LogAnnotation(targetType = "productSpecification-add", remark = "添加其他信息")
    @RequestMapping(value = "/addProductSpecificationList",method = RequestMethod.POST)
    public DataOutput<ProductSpecificationDto>addProductSpecificationList(HttpServletRequest request, @RequestBody ProductSpecificationAddDto productSpecificationAddDto){
        return productSpecificationService.addProductSpecificationList(request,productSpecificationAddDto);
    }

    @ApiOperation("根据产品id查看其他信息")
    @RequestMapping(value = "/getProductSpecificationListByProductId",method = RequestMethod.POST)
    public DataOutput<ProductSpecificationDto>getProductSpecificationListByProductId(
            @ApiParam(value = "商品Id") @RequestParam(value = "productId") Long productId){
        return new DataOutput(productSpecificationService.getProductSpecificationListByProductId(productId));
    }


}
